<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    function clone (data) {
        const type = Object.prototype.toString.call(data).slice(8, -1).toLowerCase();
        console.log(type);
        if (type === 'array') {
            return [].concat(data)
        } else if (type === 'object') {
            return Object.assign({}, data)
        } else {
            return data
        }
    }

    var a = [{}];

    function change (arg) {
        arg.push('vvvv')
    }

    change (clone(a));

    console.log('%cHello', 'color: #43bb88;font-size: 24px;font-weight: bold;text-decoration: underline;');
    console.log(a)
</script>
</body>
</html>
